var tableData = {
	url : ctp + "/processController/selectProcessInfo.shtml",
	hrefs : [[ "function=checkProcess", "recId=REC_ID,taskType=TASK_TYPE,auditId=AUDIT_ID", "查看", null ]],
	propertys : [ "APPLY_CODE","NAME","USER_NAME","REC_TIME","TASK_TYPE_CHAR","AUDIT_STATE_CHAR"],
	checkBox:["REC_ID",false],
	opers : true,
	startLoad : function() {
		getListData(this);
	}
};
function searchData(curr) {
	setTagAndValue("form1", "curr", curr);
	setTagAndValue("form1","SUNNADA_PAGE_SIZE",5); 
	tableData.startLoad();
}
$(document).ready(function() {
	searchData();
	getNoDealWithNumber();
	searchData1();
});

function getNoDealWithNumber(){
	$.ajax({ 
	 	url: ctp + "/processController/getNoDealWithNumber.shtml",
		type : 'POST',
		dataType: "json", 
		success : function(result) {
			if(result != null){
				var map = result.map;
				$("#noDealWithNumber").html("有" + map.number + "条待处理");
			}
		}
	});
}

function checkProcess(recId, taskType, auditId){
	window.location.href = ctp + "/processController/goDetailPage.shtml?recId=" + recId + "&taskType=" + taskType + "&auditId=" + auditId;
}


function searchData1(curr) {
	getProjectStatistics(curr)
}

function getProjectStatistics(curr){
	
	//---开始的页数
	setTagAndValue("form2","curr",curr); 
	//---每页几条数据
	setTagAndValue("form2","SUNNADA_PAGE_SIZE",5); 
	$.ajax({
		url: ctp + "/processController/smartHomeSearch.shtml", 
		data: $('#form2').serialize(),
		type: "POST", 
		cache : false, 
		dataType: "json", 
		success: function(data) {
		    var list = data.list; 
		    var pageJson = data.params;
		    $("#tbodyData").html("");
		    $str="";
		    $str +="<tr><td>项目名称</td><td>项目进度</td><td class='txt-center'>参与工人数量</td><td class='txt-center'>在场工人数量</td></tr>"
			for (var i = 0; i < list.length; i++) {
				var l = list[i];
				$str +="<tr><td>"+l.name+"</td>";
				$str +="<td class='smart-td_progress'><div class='layui-progress' lay-showPercent='yes'>";
				$str +="<div class='layui-progress-bar layui-bg-blue'lay-percent='"+l.process+"'></div></div></td>";
				$str +="<td class='txt-center'>"+l.total_worker+"</td>";
				$str +="<td class='txt-center'>"+l.in_work_worker+"</td></tr> ";
			}
		    $("#tbodyData").append($str);
		    element.init();
			 //------------   分页开始  -------------
			 getPaging2(pageJson,list,1,1);
		    //------------  分页结束      -------------
	    }

	});
}